//
//  allActiveView.m
//  YuErmuYing
//
//  Created by Tiancheng on 16/9/17.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "allActiveView.h"
#import "Macros.h"
@implementation allActiveView

-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        UIView *headerView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, screenWidth, 35)];
        headerView.backgroundColor=customGrayColor;
        self.nameLabel=[[UILabel alloc]initWithFrame:CGRectMake(12, 7, 100, 21)];
        self.nameLabel.textColor=pinkColor;
        self.nameLabel.font=[UIFont systemFontOfSize:13.0];
        self.nameLabel.text=@"婴儿游泳";
        
        self.moreButton=[[UIButton alloc]initWithFrame:CGRectMake(screenWidth-150, 0, 150, 35)];
        //按钮的背景色(黄色)
//        self.moreButton.backgroundColor=[UIColor orangeColor];
//        [self.moreButton addTarget:self action:@selector(onMoreClick:) forControlEvents:UIControlEventTouchUpInside];
        self.moreLabel=[[UILabel alloc]initWithFrame:CGRectMake(screenWidth-60, 7, 50, 21)];
        self.moreLabel.textColor=[UIColor blackColor];
        self.moreLabel.text=@"更多";
        self.moreLabel.font=[UIFont systemFontOfSize:13.0];
        self.rightImageView=[[UIImageView alloc]initWithFrame:CGRectMake(screenWidth-20, 5, 10, 21)];
        self.rightImageView.image=[UIImage imageNamed:@"right"];
        [headerView addSubview:self.moreButton];
        [headerView addSubview:self.rightImageView];
        [headerView addSubview:self.moreLabel];
        [headerView addSubview:self.nameLabel];
        [self addSubview:headerView];
        float nextView_y=headerView.frame.size.height;
        UIView *nextView=[[UIView alloc]initWithFrame:CGRectMake(0, nextView_y, screenWidth, 5+21+5+0.174*screenWidth+5+21+5)];
        float width_0=screenWidth/3;
        float width=width_0-2;
        for (int i=0; i<3; i++)
        {
            if (i==0)
            {
                self.view01=[[UIView alloc]initWithFrame:CGRectMake(0, 0, width_0, nextView.frame.size.height)];
//                self.view01.backgroundColor=[UIColor orangeColor];
                [nextView addSubview:self.view01];

                self.nameLabel01=[[UILabel alloc]initWithFrame:CGRectMake(5, 5, width-10, 21)];
                self.nameLabel01.font=[UIFont systemFontOfSize:13.0];
//                self.nameLabel01.text=@"贝贝幼儿游泳01";
                self.nameLabel01.textColor=[UIColor blackColor];
                self.nameLabel01.textAlignment=NSTextAlignmentCenter;
                [nextView addSubview:self.nameLabel01];
                float picImageView_y=self.nameLabel01.frame.origin.y+self.nameLabel01.frame.size.height+5;
                self.picImageView01=[[UIImageView alloc]initWithFrame:CGRectMake(0.05333*screenWidth, picImageView_y, 0.214*screenWidth, 0.174*screenWidth)];
                [nextView addSubview:self.picImageView01];
                float line_y=self.picImageView01.frame.size.height+self.picImageView01.frame.origin.y+40;
                UIView *line=[[UIView alloc]initWithFrame:CGRectMake(width, 0, 2, line_y)];
                line.backgroundColor=customGrayColor;
                [nextView addSubview:line];
                float tuanLabel01_y=self.picImageView01.frame.origin.y+self.picImageView01.frame.size.height+5;
                
                self.tuanLabel01=[[UILabel alloc]initWithFrame:CGRectMake(0.03*screenWidth, tuanLabel01_y, 50, 21)];
//                self.tuanLabel01.text=@"团购价";
                self.tuanLabel01.textColor=[UIColor blackColor];
                self.tuanLabel01.font=[UIFont systemFontOfSize:11.0];
                [nextView addSubview:self.tuanLabel01];

                float moneyLabel01_x=self.picImageView01.frame.origin.x+self.picImageView01.frame.size.width-30;
                self.moneyLabel01=[[UILabel alloc]initWithFrame:CGRectMake(moneyLabel01_x, tuanLabel01_y, 100, 21)];
                self.moneyLabel01.textColor=pinkColor;
//                self.moneyLabel01.text=@"¥45";
                self.moneyLabel01.font=[UIFont systemFontOfSize:11.0];
                [nextView addSubview:self.moneyLabel01];

            }
            else if (i==1)
            {
                self.view02=[[UIView alloc]initWithFrame:CGRectMake(width_0, 0, width_0, nextView.frame.size.height)];
//                self.view02.backgroundColor=[UIColor orangeColor];
                [nextView addSubview:self.view02];
                self.nameLabel02=[[UILabel alloc]initWithFrame:CGRectMake(width_0, 5, width, 21)];
                self.nameLabel02.font=[UIFont systemFontOfSize:13.0];
//                self.nameLabel02.text=@"贝贝幼儿游泳02";
                self.nameLabel02.textColor=[UIColor blackColor];
                self.nameLabel02.textAlignment=NSTextAlignmentCenter;
                [nextView addSubview:self.nameLabel02];
                float picImageView_y=self.nameLabel02.frame.origin.y+self.nameLabel02.frame.size.height+5;
                self.picImageView02=[[UIImageView alloc]initWithFrame:CGRectMake(0.05333*screenWidth+width_0, picImageView_y, 0.214*screenWidth, 0.174*screenWidth)];
                [nextView addSubview:self.picImageView02];
                float line_y=self.picImageView02.frame.size.height+self.picImageView02.frame.origin.y+40;
                UIView *line=[[UIView alloc]initWithFrame:CGRectMake(width_0+width, 0, 2, line_y)];
                line.backgroundColor=customGrayColor;
                [nextView addSubview:line];
                
                float tuanLabel02_y=self.picImageView02.frame.origin.y+self.picImageView02.frame.size.height+5;
                self.tuanLabel02=[[UILabel alloc]initWithFrame:CGRectMake(0.03*screenWidth+width_0, tuanLabel02_y, 50, 21)];
//                self.tuanLabel02.text=@"团购价";
                self.tuanLabel02.textColor=[UIColor blackColor];
                self.tuanLabel02.font=[UIFont systemFontOfSize:11.0];
                [nextView addSubview:self.tuanLabel02];
                
                float moneyLabel02_x=self.picImageView02.frame.origin.x+self.picImageView02.frame.size.width-30;
                self.moneyLabel02=[[UILabel alloc]initWithFrame:CGRectMake(moneyLabel02_x, tuanLabel02_y, 100, 21)];
                self.moneyLabel02.textColor=pinkColor;
//                self.moneyLabel02.text=@"¥45";
                self.moneyLabel02.font=[UIFont systemFontOfSize:11.0];
                [nextView addSubview:self.moneyLabel02];
            }
            else if (i==2)
            {
                self.view03=[[UIView alloc]initWithFrame:CGRectMake(2*width_0, 0, width_0, nextView.frame.size.height)];
//                self.view03.backgroundColor=[UIColor orangeColor];
                [nextView addSubview:self.view03];
                self.nameLabel03=[[UILabel alloc]initWithFrame:CGRectMake(2*width_0, 5, width, 21)];
                self.nameLabel03.font=[UIFont systemFontOfSize:13.0];
//                self.nameLabel03.text=@"贝贝幼儿游泳03";
                self.nameLabel03.textColor=[UIColor blackColor];
                self.nameLabel03.textAlignment=NSTextAlignmentCenter;
                [nextView addSubview:self.nameLabel03];
                float picImageView_y=self.nameLabel03.frame.origin.y+self.nameLabel03.frame.size.height+5;
                self.picImageView03=[[UIImageView alloc]initWithFrame:CGRectMake(0.05333*screenWidth+2*width_0, picImageView_y, 0.214*screenWidth, 0.174*screenWidth)];
                [nextView addSubview:self.picImageView03];
                
                float tuanLabel03_y=self.picImageView03.frame.origin.y+self.picImageView03.frame.size.height+5;
               self.tuanLabel03=[[UILabel alloc]initWithFrame:CGRectMake(0.03*screenWidth+width_0*2, tuanLabel03_y, 50, 21)];
//                self.tuanLabel03.text=@"团购价";
                self.tuanLabel03.textColor=[UIColor blackColor];
                self.tuanLabel03.font=[UIFont systemFontOfSize:11.0];
                [nextView addSubview:self.tuanLabel03];
                
                float moneyLabel03_x=self.picImageView03.frame.origin.x+self.picImageView03.frame.size.width-30;
                self.moneyLabel03=[[UILabel alloc]initWithFrame:CGRectMake(moneyLabel03_x, tuanLabel03_y, 100, 21)];
                self.moneyLabel03.textColor=pinkColor;
//                self.moneyLabel03.text=@"¥45";
                self.moneyLabel03.font=[UIFont systemFontOfSize:11.0];
                [nextView addSubview:self.moneyLabel03];
                
            }
        }
        [self addSubview:nextView];
    }
    return self;
}

@end
